package st.business.tepth.business.visitor.busnumber;

import java.util.List;

import st.business.tepth.base.OnDataConvertListener;
import st.business.tepth.business.bean.BusNumberBean;

/**
 * Author: shadow
 * Email:  1025431817@qq.com
 * Time:   2019-03-05 17:24
 */

public class BusNumberPresenter extends BusNumberContract.Presenter {
    private final BusNumberContract.View mView;
    private final BusNumberContract.Model mModel;

    public BusNumberPresenter(BusNumberContract.View view) {
        mView = view;
        mModel = new BusNumberModel();
    }

    @Override
    void getBusList(int locationId) {
        addDisposable(mModel.getBusList(locationId,
                new OnDataConvertListener<List<BusNumberBean>>() {
                    @Override
                    public void convert(List<BusNumberBean> list) {
                        if (mView != null) {
                            mView.showBusList(list);
                        }
                    }

                    @Override
                    public void error(int code, String msg) {
                        if (mView != null) {
                            mView.showBusList(null);
                        }
                    }
                }));
    }
}
